package com.huhui.user.provider.service.impl;


import com.huhui.myutil.result.Result;
import com.huhui.myutil.result.ResultUtil;
import com.huhui.user.client.request.UserRequest;
import com.huhui.user.client.service.UserService;
import com.huhui.user.provider.dao.pojo.UserPOJO;
import com.huhui.user.provider.mapper.UserMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 胡辉
 * @email iihuhui@163.com
 * @create 2019-07-29 22:06
 */
@Service
public class UserServiceImpl  implements UserService {

    @Resource
    private UserMapper userMapper;
    @Override
    public Result<Integer> insertOne(UserRequest request) {
        UserPOJO userPOJO = new UserPOJO();
        BeanUtils.copyProperties(request,userPOJO);
        int count = userMapper.insert(userPOJO);
        return ResultUtil.successResult(count);
    }

    @Override
    public Result<Integer> updateById(UserRequest request) {
        return null;
    }
}
